<template>
<Editor :value="value" :plugins="plugins" @change="handleChange" ></Editor>

</template>

<script setup lang="ts">
import gfm from "@bytemd/plugin-gfm"
import { Editor,Viewer } from "@bytemd/vue-next"
import highlight from "@bytemd/plugin-highlight";
import {ref,withDefaults,defineProps} from "vue"
const plugins = [
  gfm(),
  highlight()
]
/**
 * 定义组件属性类型
 */
interface Props {
  value: string;
  handleChange: (v: string) => void;
}

/**
 * 给组件指定初始值
 */
const props = withDefaults(defineProps<Props>(), {
  value: () => "",
  handleChange: (v: string) => {
    console.log(v);
  },
});


const value = ref(" ")
const handleChange = (v:string) =>{
  value.value = v
}
</script>

<style scoped>
.bytemd-toolbar-icon.bytemd-tippy.bytemd-tippy-right:last-child {
    display: none;
}

</style>
